﻿@using System.Collections.Generic;
@using hc.epm.DataModel.Business;
@using hc.epm.Common;
@using hc.Plat.Common.Extend;
@model List<Epm_ProjectConstitute>
@{
    ViewBag.Title = "总批复构成详情";
}
<div class="contentData">
    <ul class="tab-list">
        <li id="Detail">基本信息</li>
        <li id="DetailApprovalConstitute" class="active">总批复构成</li>
        <li id="DetailProjectISP">工程服务商</li>
        <li id="DetailProjectMainPoint">工程要点</li>
        <li id="DetailTimeManage">工期管理</li>
        <li id="DetailMilestonePlan">工程节点</li>
        <li id="ScheduleInfo">进度跟踪</li>
        <li id="VisaInfo">签证信息</li>
        <li id="QuestionInfo">问题信息</li>
        <li id="ChangeInfo">变更信息</li>
        <li id="ContractInfo">合同信息</li>
        <li id="DetailCrossingsManage">外部手续</li>
        <li id="video">视频集成</li>
    </ul>
    <div class="tab">
        @*<div class="short-text">
            <label>&nbsp;方案选择&nbsp;:</label>
            <select disabled style="background:#ebebe5;">
                <option selected>@ViewBag.BluePrintValue</option>
            </select>
        </div>
        <div class="long-text">
            <label>&nbsp;外部手续&nbsp;:</label>
            @if (ViewBag.IsCrossings == null || ViewBag.IsCrossings == false)
            {
                <input type="radio" class="Crossings" name="Crossings" value="0" checked />@Html.Raw("无");
            }
            else
            {
                <input type="radio" class="Crossings" name="Crossings" value="1" checked />@Html.Raw("办理");
            }
        </div>
        <div class="long-text">
            <label>&nbsp;附件上传&nbsp;:</label>
            <div style="width:100%;padding-bottom:10px;" id="fileListFile">
                <ul class="fileShow" id="fileDetail"></ul>
                <input type="hidden" name="fileDataJsonFile" id="fileDataJsonFile">
            </div>
        </div>*@
        <div class="long-text" style="margin-top:15px;">
            <label>&nbsp;合计&nbsp;:</label>
            <input type="text" value="@(ViewBag.Amount==null?" ":ViewBag.Amount.ToString(" 0.######"))" disabled />&nbsp;万元
        </div>
        <div class="long-text">
            <label>&nbsp;剩余金额&nbsp;:</label>
            <input type="text" value="@(ViewBag.BalanceAmount==null?"":ViewBag.BalanceAmount.ToString(" 0.######"))" disabled />&nbsp;万元
        </div>
        <div class="long-text">
            <label>&nbsp;甲供设备&nbsp;:</label>
            <input type="text" value="@(ViewBag.AProvideAmount==null?"":ViewBag.AProvideAmount.ToString(" 0.######"))" disabled />&nbsp;万元
        </div>
        @if (Model != null && Model.Count() > 0)
        {
            foreach (var item in Model)
            {
                if (!item.IsAProvide.HasValue || !item.IsAProvide.Value)
                {
                    <div class="long-text long-text-other">
                        <label>&nbsp; @item.ConstituteValue &nbsp;:</label>
                        <input type="text" value="@(item.Amount == null ? "" : item.Amount.Value.ToString(" 0.######"))" disabled />&nbsp;万元
                    </div>
                }
            }
            foreach (var item in Model)
            {
                if (item.IsAProvide.HasValue && item.IsAProvide.Value)
                {
                    <div class="long-text long-text-other">
                        <label>&nbsp; @item.ConstituteValue &nbsp;:</label>
                        <input type="text" value="@(item.Amount == null ? "" : item.Amount.Value.ToString(" 0.######"))" id="Amount" name="Amount" disabled />&nbsp;万元
                    </div>
                }
            }
        }
    </div>
</div>
<script>
    //获取附件
    $.post("/Files/GetFileList", { tableName: 'Epm_Project', id: '@ViewBag.ProjectId', tableCol: "Constitute" }, function (data) {
        if (data.Flag) {
            if (data.Data.length > 0) {
                data.Data.forEach(function (item, index, arr) {
                    if (item.ImageType == null) {
                        var odiv = '<li id="' + item.GuidId + '">';
                        odiv += '<div class="downloadFile"><img src="' + getFileImg(item.Name) + '" style="width: 20px;height: 20px;cursor: pointer;" class="imgShow"/><a href="javascript:;" target="_blank">' + item.Name + '</a></div>';
                        odiv += '<div>' + item.Size + '</div>';
                        odiv += '<span style="margin-left:20px;">' + item.CreateUserName + '</span>';
                        odiv += '<span style="margin-left:20px;">' + new Date(formatDateByJson(item.CreateTime)).Format("yyyy-MM-dd") + '</span>';
                        odiv += '<span style="margin-left:30px;cursor: pointer;color:blue" class="fileDel" data-val="' + item.GuidId + '">删除</span>'
                        odiv += '</li>';
                        $('#fileListFile .fileShow').append(odiv);
                    }
                });
            }
        } else {
            parent.layer.alert(data.Message, { icon: 2 });
        }
    });
    $(function () {
        $("#Detail").click(function () {
            window.location.href = 'Detail?projectId=@ViewBag.ProjectId';
        });
        $("#DetailProjectMainPoint").click(function () {
            window.location.href = 'DetailProjectMainPoint?projectId=@ViewBag.ProjectId';
        });
        $("#DetailTimeManage").click(function () {
            window.location.href = 'CKTimeLimitDetail?projectId=@ViewBag.ProjectId';
        });
        $("#DetailMilestonePlan").click(function () {
            window.location.href = 'DetailMilestonePlan?projectId=@ViewBag.ProjectId';
        });
        $("#DetailProjectISP").click(function () {
            window.location.href = 'DetailProjectISP?projectId=@ViewBag.ProjectId';
        });
        $("#DetailProjectData").click(function () {
            window.location.href = 'DetailProjectData?projectId=@ViewBag.ProjectId';
        });
        $("#ScheduleInfo").click(function () {
            window.location.href = 'ScheduleInfo?projectId=@ViewBag.ProjectId';
        });
        $("#ContractInfo").click(function () {
            window.location.href = 'ContractInfo?projectId=@ViewBag.ProjectId';
        });
        $("#ChangeInfo").click(function () {
            window.location.href = 'ChangeInfo?projectId=@ViewBag.ProjectId';
        });
        $("#VisaInfo").click(function () {
            window.location.href = 'VisaInfo?projectId=@ViewBag.ProjectId';
        });
        $("#QuestionInfo").click(function () {
            window.location.href = 'QuestionInfo?projectId=@ViewBag.ProjectId';
        }); 
        $("#DetailCrossingsManage").click(function () {
            window.location.href = 'CKProcedureDetail?projectId=@ViewBag.ProjectId';
        });
        $("#video").click(function () {
            window.location.href = 'Video?projectId=@ViewBag.ProjectId';
        });
        //下载附件
        $("body").on("click", ".downloadFile", function () {
            var group = $(this).parent().find(".hiddenArea").data("group");
            var path = $(this).parent().find(".hiddenArea").data("url");
            var fileName = $(this).parent().find(".hiddenArea").data("filename");
            window.location.href = "/Download/DownLoadHB?group=" + group + "&path=" + path + "&fileName=" + fileName;
        });
    });
</script>